# delimit ;
clear ;
cd "replication" ;
set more off ; 

* *************************************************************************** ;
* re-run midline analysis
* *************************************************************************** ;

cd ".." ;
do "./replication/do/table05-endline-behavior.do" ; 

****************************************************************************** ;
* robustness check
****************************************************************************** ;

* excluding subjects assigned to counseling and/or goal setting ; 
drop if financial_counseling == 1 | financial_goal_setting == 1 ;

est drop _all ; 

foreach var in behav_all $module1_behav $module23_behav $module4_behav $module5_behav  { ;
	
	areg `var' healthonly healthandpay, a(strata) robust ;
	qui est sto `var'; 
	
	test healthonly = healthandpay ; 
	estadd local titlerow = "" ; 
	estadd scalar fstat = r(F): `var' ; 
	estadd scalar pval = r(p): `var' ; 

	summarize `var' if control == 1 & e(sample) == 1;
	estadd scalar cmean = r(mean): `var' ; 
	estadd scalar csd = r(sd): `var' ;

} ;

esttab behav_all water* wash* pregnancy* aids* condom* night* using "./output/appendix-table-endline-behavior-excluding-couns-goal.tex",
	replace
	drop(_cons) 
	cells(b(label() star fmt(%9.3f %9.3f)) se(par)) 
	star(* 0.10 ** 0.05 *** 0.01) 
	stats(titlerow fstat pval cmean csd N, fmt(%9s %9.3f %9.3f %9.3f %9.3f %9.0f) labels("\(F\)-test, HEE = HEEC" "$\qquad$ \(F\)-statistic" "$\qquad$ \(p\)-value" "Control Mean" "Control SD" "N"))
	prehead(\begin{table}[htbp] \centering \normalsize `"\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}"'
		\captionsetup{justification=centering} 
		\caption{Effects on Health Behaviors \\ Robustness Check, Pure Placebo Group}
		\label{appendix-table-endline-behavior-excluding-couns-goal}
		\begin{tabular*}{\hsize}{p{4cm}p{1.4cm}p{1.4cm}p{1.4cm}p{1.4cm}p{1.4cm}p{1.4cm}p{1.4cm}p{1.4cm}p{1.4cm}}
		\toprule)
	legend label  booktabs  collabels( , none)
	mgroups(
	"All Topics" 
	"\shortstack[c]{Cleanliness\\and Hygiene}"
	"\shortstack[c]{Midwives,\\Maternal \& Child\\Health}"
	"\shortstack[c]{Condoms, AIDS,\\Syphilis}" 
	"\shortstack[c]{Night-\\blindness}"
	, pattern(1 1 0 0 1 0 1 0 1) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))
	postfoot(`"\bottomrule"'  \end{tabular*} \captionsetup{justification=justified, width=\hsize} 
		\caption*{\footnotesize \textit{Notes:} Re-estimation of Table \ref{table-endline-behavior},
		but excluding respondents in the placebo film group who were randomized into additional financial-related
		treatments (i.e., financial counseling and/or goal setting). Thus, the control group in this regression
		consists of respondents who were assigned to only financial films.
		***\$\,p < 0.01$, **\$\,p < 0.05$, *\$\,p<0.10$.
		}
		\end{table}) ;
		
exit ;

